﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using XCommunity.Users;
using XCommunity.Frames;
using System.Security.Principal;
using XCommunity.Blogs.Frames;
using XCommunity.Blogs.Views;

namespace XCommunity.Blogs
{
  public class BlogSystem : ICommunitySystem
  {


    public BlogSystem( ICommunityContext context )
    {
      Context = context;
      UserService = new BlogUserService();
      ProfilerViewService = new ProfilerViewService( this );
    }



    public ICommunityContext Context
    {
      get;
      private set;
    }


    internal BlogUserService UserService
    {
      get;
      private set;
    }


    public ProfilerViewService ProfilerViewService
    {
      get;
      private set;
    }


    public virtual void Init()
    {

    }


    public string GetOwner( GeneralTopicFrame topic )
    {
      if ( topic.CommunitySystem.Guid != Guid )
        return null;

      return topic.Meta.Launcher;
    }


    public BlogFrame GetBlog()
    {
      throw new NotImplementedException();
    }


    public BlogFrame GetBlog( string name )
    {
      throw new NotImplementedException();
    }



    #region ICommunitySystem 成员

    IUserService ICommunitySystem.UserService
    {
      get { return UserService; }
    }

    private readonly Guid _guid = new Guid( "{0D279911-26D2-427d-8385-47C66BAE8A49}" );

    public Guid Guid
    {
      get { return _guid; }
    }

    public ICommunityPlugin[] Plugins
    {
      get { throw new NotImplementedException(); }
    }

    #endregion
  }
}
